/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package rockpaperscissors;
import java.util.Scanner;

/**
 *
 * @author Anne
 */
public class RockPaperScissors {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        String p1, p2;
        Scanner keyboard  = new Scanner (System.in);
        boolean noWinner = true;
        boolean playAgain = true;
        boolean winner= true;
        
        System.out.println("Player 1");
        System.out.println("Please enter your choice for the Rock-Paper-Scissors Game:");
        System.out.println("R: rock");
        System.out.println("P: paper");
        System.out.println("S: scissors");
        System.out.println("Paper covers rock, Rock breaks scissors, Scissors cut paper!!");
        
        p1 = keyboard.next();
        p1 = p1.toUpperCase();
        
        System.out.println("Player 2");
        System.out.println("Please enter your choice for the Rock-Paper-Scissors Game:");
        System.out.println("R: rock");
        System.out.println("P: paper");
        System.out.println("S: scissors");
        System.out.println("Paper covers rock, Rock breaks scissors, Scissors cut paper!!");
        
        p2 = keyboard.next();
        p2 = p2.toUpperCase();
        
        //Method call to check if player 1 wins. 
             //rock vs paper
        if (p1.equals("R") && p2.equals("P"))
        {
        	winner = false;
        }
        
        if (p1.equals("P") && p2.equals("R"))
        {
        	winner = true;
        }
        
        
        //rock vs scissor
        if (p1.equals("R") && p2.equals("S"))
        {
        	 winner = true;
        }
        
        if (p1.equals("S") && p2.equals("R"))
        {
        	winner = false;
        }
        
        //rock vs rock
        if (p1.equals("R") && p2.equals("R"))
        {
        	System.out.println("Tied Game No Winner");
                winner = false;
        }
        
      //paper vs scissor
        if (p1.equals("P") && p2.equals("S"))
        {
        	winner = false;
        }
        
        if (p1.equals("S") && p2.equals("P"))
        {
        	winner = true;
        }
  
        
      //paper vs paper
        if (p1.equals("P") && p2.equals("P"))
        {
        	System.out.println("Tied Game No Winner");
                winner = false;
        }
        
      //scissor vs scissor
        if (p1.equals("S") && p2.equals("S"))
        {
        	System.out.println("Tied Game No Winner");
                winner = false;
        }
        
        
        if (winner==true)
 	   {
 		   System.out.println("Player 1 is the Winner");
 	   }
		
	
      
        
        
        //Method call to check if player 2 wins
        //No Winner to the game - automatic replay
        
    }
            
}
